#ifndef __RECT_H__
#define __RECT_H__
/////////////////
//include
/////////////////
#include"Vector2D.h"
#include"Line2D.h"
#include"../CXBurst/Enum.h"
/////////////////
//const
/////////////////

/////////////////
//class
/////////////////
CXEnum(RectDirection)
	Right,
	Left,
	Up,
	Dwon,
CXEnumEnd
struct CollisionInfo
{
	CollisionInfo(bool is_hit,	Vector2D pos,	RectDirection::Type type)
	{
		this->is_hit = is_hit;
		this->pos = pos;
		this->rect_direction_type = type;
	}
	bool is_hit;
	Vector2D pos;
	RectDirection::Type rect_direction_type;
};
class Rect
{
public:
	Rect( float x = 0,float y= 0, float width= 0,float height= 0);
	Rect(Vector2D start,Vector2D end);
	~Rect();
	bool Collision(const Rect& rect);
	CollisionInfo GetCollisionInfo(const Rect& rect);
	Vector2D CollisionPos(const Rect& rect,Vector2D pos,Vector2D pre_pos);
	bool Collision(const Vector2D& point);
	float GetRight()	const {	return x + width/2;}
	float GetLeft()		const{	return x - width/2;}
	float GetUp()		const{	return y - height/2;}
	float GetBottom()	const{	return y + height/2;}
	Vector2D GetRightUp()	const{	return Vector2D(GetRight(),	GetUp());}
	Vector2D GetLeftUP()	const{	return Vector2D(GetLeft(),	GetUp());}
	Vector2D GetRightDown()	const{	return Vector2D(GetRight(),	GetBottom());}
	Vector2D GetLeftDown()	const{	return Vector2D(GetLeft(),	GetBottom());}

	Vector2D GetPos()	const{	return Vector2D(x,y);}
	Vector2D GetSize()	const{	return Vector2D(width,height);}



	void SetPos(Vector2D pos){x = pos.x;y = pos.y; }
	float x;
	float y;
	float width;
	float height;
};
#endif __RECT_H__
